package com.alibaba.citrus.ots.platform.enhance.facade.service.diff.common;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;

/**
 * @author: qiaojiange
 * @create: 2022/01/23
 * @Description Date 转换成 LocalDateTime
 */
public class Date2LocalDateTimeUtils {

    /**
     * 日期转换成 LocalDateTime
     * @param date 日期
     * @return LocalDateTime
     */
    public static LocalDateTime parse(Date date) {
        if (date == null) {
            return null;
        }

        Instant instant = date.toInstant();
        ZoneId zoneId = ZoneId.systemDefault();
        LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime();
        return localDateTime;
    }


}
